<template>
	<view class="transfer">
		<!-- #ifdef APP-PLUS -->
		<Hearder :name="'代充'"></Hearder>
		<!-- #endif -->
		<view class="content">
			<view class="payee">
				收款人:
				<text>
					{{datainfo.nickName}}
					<text>({{datainfo.identity_name}})</text>
				</text>
			</view>
			<view class="zhuanzhang">
				<view class="title">转账金额</view>
				<view class="zzlist">
					<view>
						<text>￥</text>
						<input :placeholder="'当前'+changename.div_price_name+'（￥'+datainfo.e_card_number+')'" placeholder-style="color:#999;font-size:24rpx;font-weight: 400;" v-model="price"/>
					</view>
				</view>
			</view>
			<view class="submit" @click="paysubmit">转账</view>
		</view>
		<Paypwd ref="paystatus" :totalprice="totalprice" @paymoney="paymoney"></Paypwd>
	</view>
</template>

<script>
	import Paypwd from '@/pages/common/paypwd.vue'
	export default {
		data(){
			return{
				datainfo:{},
				price:'',
				member_id:'',
				totalprice:0,
				changename:{}
			}
		},
		onLoad(option) {
			if(option.member_id){
				this.member_id = option.member_id
			}
			this.getinit()
			this.request('/index/getSpaceSetting').then(res => {
				if(res.data.code==1){
					this.changename = res.data.data
				}
			})
		},
		methods:{
			getinit(){
				this.request('/team/getDetail',{member_id:this.member_id}).then(res => {
					if(res.data.code==1){
						this.datainfo = res.data.data
					}
				})
			},
			paysubmit(){
				this.request('/member/getIsPayPassword').then(res => {
					if(res.data.code==1){
						if(res.data.data==0){
							this.$refs.paystatus.payflag = true
						}else{
							this.totalprice = this.price
							this.$refs.paystatus.zhifuflag = true
						}
					}else{
						this.$tip(res.data.msg)
					}
				})
			},
			paymoney(){
				if(this.price==0){
					this.$tip("转账金额必须大于0")
				}else{
					this.request('/team/toTransfer',{
						member_id:this.member_id,
						price:this.price
					}).then(res => {
						if(res.data.code==1){
							this.$tip(res.data.msg)
							this.$refs.paystatus.zhifuflag = false
							setTimeout(()=>{
								uni.navigateBack()
							},500)
						}else{
							this.$tip(res.data.msg)
						}
					})
				}
			},
			toPage(a){
				this.payflag=false
				uni.navigateTo({
				    url: a
				});
			}
		},
		components:{
			Paypwd
		}
	}
</script>

<style scoped lang="scss">
	.transfer{
		.content{
			margin: 0 3%;
			.payee{
				font-weight: 600;
				padding: 36rpx 0;
				border-bottom: $uni-border-bottom;
				>text {
					font-weight: 400;
					text{
						color: $uni-text-color;
					}
				}
			}
			.zhuanzhang{
				padding: 28rpx 0 20rpx;
				border-bottom: $uni-border-bottom;
				.title{
					font-size: 26rpx;
				}
				.zzlist{
					display: flex;
					align-items: center;
					margin-top: 30rpx;
					>view{
						width: 100%;
						display: flex;
						text{
							margin-top: 14rpx;
						}
						text{
							font-size: 26rpx;
							font-weight: 800;
						}
						input{
							width: 90%;
							font-size: 32rpx;
							margin-left: 20rpx;
							margin-top: 8rpx;
						}
					}
				}
			}
			.submit{
				height: 88rpx;
				border-radius: 10rpx;
				background: #F7403E;
				font-size: 32rpx;
				text-align: center;
				line-height: 88rpx;
				color: #fff;
				margin-top: 50rpx;
			}
		}
		.quanping{
		    position: fixed;
		    width: 100%;
		    height: 100%;
		    z-index: -1;
		    background: rgba(0,0,0,.3);
		    top: 0;
		    opacity: 0;
		    transition: all .3s;
		    &.sureafter{
		  	  opacity: 1;
		  	  z-index: 999;
		    }
		    .tip_con{
		  	  position: absolute;
		  	  top: 50%;
		  	  left: 50%;
		  	  transform: translate(-50%,-50%);
		  	  width: 80%;
		  	  text-align: center;
		  	  .tankuangpay{
		  			border-radius: 14rpx;
		  			background: #fff;
		  			padding: 50rpx 0;
		  			margin-bottom: 50rpx;
		  			>view{
		  				text-align: center;
		  				&:first-of-type{
		  					view{
		  						text-align: center;
		  						font-size: 32rpx;
		  						line-height: 40rpx;
		  						&:last-of-type{
		  							font-size: 28rpx;
		  							padding-top: 30rpx;
		  							text{
		  								color: $uni-item-color;
		  								font-size: 28rpx;
		  							}
		  						}
		  					}
		  				}
		  				&.agent_con{
		  					color: #999;
		  					font-size: 26rpx;
		  					padding: 20rpx 0;
		  					text{
		  						color: $uni-text-color;
		  						font-size: 26rpx;
		  					}
		  					.icon{
		  						position: relative;
		  						top: 6rpx;
		  						margin-right: 10rpx;
		  					}
		  				}
		  			}
		  			.paymoney{
		  				font-size: 28rpx !important;
		  				margin: 20rpx 0;
		  			}
		  			.smlbummit{
		  				height: 70rpx;
		  				margin: 0 14%;
		  				background: $uni-item-color;
		  				text-align: center;
		  				line-height: 70rpx;
		  				border-radius: 100rpx;
		  				margin-top: 30rpx;
		  				font-size: 28rpx;
						color: #fff;
		  			}
		  			.forget{
		  				font-size: 26rpx;
		  				color: #6F90CB;
		  				margin-top: 20rpx;
		  			}
		  		}
		    }
		}
	}
</style>
